<template>
  <div class="boa">
    <!-- 商机区域 -->
    <Head title="商 机" id="backstyle"> </Head>
    <Banner id="7" class="bannerId"></Banner>
    <!-- 版心区域 -->
    <!-- 商机总区域 -->
    <div class="tp title-center">
      <!-- 商机区域 -->

      <!-- 用户单位文字区域 -->
      <div class="umit">
        <div class="xiao tac">
          <div class="left"></div>
          <div class="zhong bold-size l-h">
            {{ this.$route.query.title }}&nbsp;&nbsp;({{
              this.$route.query.city
            }})
          </div>
        </div>
      </div>
    </div>
    <!-- 中国十大名茶内容区域 -->
    <div v-if="teacontext" class="context area-center bold-size">
      <div v-if="list && list.length">
        <div class="small " v-for="(item, index) in list" :key="index">
          <!-- 原点区域 -->
          <div class="num">{{ index + 1 }}.</div>
          <!-- 内容区域 -->
          <div class="right">
            {{ item.name }}
          </div>
        </div>
      </div>
      <div v-else class="text-cenetr p-20">暂无数据</div>
    </div>

    <!-- 定位和全国各省内容区域 -->
    <div v-else class="context area-center bold-size">
      <div v-if="list && list.length">
        <div v-for="(item, index) in list" :key="index">
          <div class="text">
            <div class="icontop title-center m-t-0">
              <div class="icon">
                <img src="../../../assets/black_star.png" alt="" />
              </div>
              <div class="tex">
                {{ item.father }}
              </div>
            </div>
            <div
              class="small m-t-07"
              v-for="(v, i) in item.list"
              :key="i"
              @click="legal()"
            >
              <!-- 原点区域 -->
              <div class="num">{{ i + 1 }}.</div>
              <!-- 内容区域 -->
              <div class="right">
                {{ v.name }}
              </div>
            </div>
          </div>
        </div>
      </div>
      <div v-else class="bold-size tac c999 m-t-20">暂无数据</div>
    </div>
  </div>
</template>

<script>
import { getFather } from "@/api/index";
import Head from "@/components/public/HeadPage.vue";
import Banner from "@/components/Home/BannerView.vue";
export default {
  data() {
    return {
      list: [],
      teacontext: false, //中国十大名茶隐藏
      teaone: "",
    };
  },
  components: {
    Head,
    Banner,
  },
  mounted() {
    let data = {
      provincial: this.$route.query.citysub,
      id: this.$route.query.id,
    };

    if (this.$route.query.title == "海外名茶") {
      // this.teacontext = true
      getFather(
        (data = {
          provincial: "海外",
          id: this.$route.query.id,
        })
      ).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.data;
        }
      });
    } else {
      this.teacontext = false;
      getFather(data).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.data;
        }
      });
    }
  },
  methods: {
    legal() {
      this.$router.push({ path: "/applet" });
    },
  },
};
</script>

<style scoped>
.boa {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* 图标区域 */
.top img {
  width: 0.24rem;
  margin-right: 0.05rem;
}
/* 商机总区域 */
.tp {
  width: 100%;

}
h3 {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  font-size: 0.24rem;
  border-bottom: 2px solid #dad9df;
}
h3 img {
  width: 0.28rem;
  margin-right: 0.05rem;
}
/* 用人单位区域 */
.umit {
  width: 100%;
}
.xiao {
  width: 100%;

  display: flex;
  align-items: center;
}

/* 中间区域 */

/* 内容区域 */
.context .text {
  width: 100%;

}
.icontop {
  display: flex;
}
.small {
  width: 100%;
  display: flex;
}
/* 原点区域 */
.num {
  height: 100%;
  display: flex;
  justify-content: center;
  /* align-items: center; */
  margin-left: 0.06rem;
  padding-top: 0.01rem;
}

/* 内容区域 */
.right {
  width: 94%;
  height: 100%;
  padding-left: 0.05rem;
}

/* 左边区域 */
.context .icon {
  width: 5%;
  height: 0.3rem;
  padding-top: 0.03rem;
}
.icon img {
  width: 0.2rem;
  height: 0.2rem;
}

/* 中间区域 */
.context .tex {
  width: 95%;
  height: 100%;
  line-height: 0.3rem;
  padding-left: 0.05rem;
}
</style>